package sk.uniza.fri.cerviix.client.game;

import org.lwjgl.opengl.GL11;

public class WormPart
{
	static private final float
		playerColor[] = {0.0f, 1.0f, 0.0f},
		enemyColor[] = {1.0f, 0.0f, 0.0f};
	
	private float x, y;
	private float[] color;
	
	public WormPart(Align align, float x, float y)
	{
		this.x = x;
		this.y = y;
		
		switch (align)
		{
			case PLAYER:
				color = playerColor;
				break;
			case ENEMY:
				color = enemyColor;
				break;
		}
	}
	
	public void draw()
	{
		GL11.glPushMatrix();
			GL11.glTranslatef(x, y, 0);

			GL11.glColor3f(color[0], color[1], color[2]);
			
			float size = 1.0f;
			
			GL11.glBegin(GL11.GL_QUADS);
				GL11.glVertex2f(-size,-size);
				GL11.glVertex2f( size,-size);
				GL11.glVertex2f( size, size);
				GL11.glVertex2f(-size, size);
			GL11.glEnd();
		GL11.glPopMatrix();
	}
	
	public static enum Align
	{
		PLAYER,
		ENEMY;
	}
}
